﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Globalization;
using OpenPhotoAlbum.Controls;

namespace OpenPhotoAlbum.Shared
{
	public partial class Home : AlbumPage
	{
		protected override void OnInit(EventArgs e)
		{
			base.OnInit(e);

			this.Title = StringUtility.Format(Resources.Strings.Title_Shared_Home, AlbumOwner.UserName);
		}

        protected override void AppendSiteMapNodes(OpenPhotoAlbum.Controls.AlbumSiteMapProvider provider)
        {
            base.AppendSiteMapNodes(provider);

            provider.AppendSiteMapNode(Resources.Strings.SC_Home, Links.Default);
            provider.AppendSiteMapNode(StringUtility.Format(Resources.Strings.Shared_Title, AlbumOwner.UserName), RawUrl);
        }

		private DbAccess.User AlbumOwner
		{
			get
			{
				Shared masterPage = this.Master as Shared;
				if (masterPage == null) { return null; }

				DbAccess.User user = masterPage.User;
				if (user == null) { return null; }

				return user;
			}
		}
	}
}
